!init.
+!init : true
    <-  .println(A);
		createWorkspace("domainUserWorkspace");
		joinWorkspace("domainUserWorkspace",WorkId1);
		+worspace_domain(WorkId1);		
        makeArtifact("Gui", "simulator.GuiDomainUser",[],ArtGuiId);
		+gui_artifact(ArtGuiId);
		focus(ArtGuiId);
		!create_artifacts.
		//showDescriptors("1","uno-dos-tres").

       
+!create_artifacts
   <-  makeArtifact("FileSystemInterface", "artifacts.FileSystemInterfaceArt", [],ArtFileId);
   		focus(ArtFileId);
		?worspace_domain(WorkId1);
		start("")[artifact_id(ArtFileId),wsp_id(WorkId1)].
  
+newDocument(DOCUMENT_ID): DOCUMENT_ID > -1 <-   
    !readDocument(DOCUMENT_ID).

+prueba(AUX): AUX > -1 <-
	.println("Prueba: ",AUX).

+!readDocument(DOCUMENT_ID): true <-
	readDocument(DOCUMENT_ID).

+document(DOC): DOC > -1 <-	  
	joinRemoteWorkspace("kmsystemworkspace","192.168.1.102",WspID2);
	+worspace_remote(WspID2);
	lookupArtifact("Iaar",Id);
	+artifact_Iaar(Id);
	focus(Id);
	readDocuments(DOC).
	
+documentProcessed(DOCUMENT_ID): DOCUMENT_ID > -1 <-
	candidateDescriptor(DOCUMENT_ID).

+documentDescriptors(DOCUMENT_ID,Descriptors): DOCUMENT_ID > -1 <-	
	?worspace_domain(WorkId1);
	?gui_artifact(ArtGuiId);
	showDescriptors(DOCUMENT_ID,Descriptors)[artifact_id(ArtGuiId),wsp_id(WorkId1)].
	
	
+saveDescriptors(Document_id,Descriptors) : Document_id > 0 <-
	?worspace_remote(Id);
	?artifact_Iaar(ArtId);
	saveDescriptors(Document_id,Descriptors)[artifact_id(ArtId),wsp_id(Id)].
	
+saveOk(Aux) : Aux > 0 <-
	.println(Aux).
	
+newDescriptors(DOCUMENT_ID): DOCUMENT_ID > -1 <-
	.println("Ready",DOCUMENT_ID).

+!create_artifact(ArtName, ArtType, Parameters)
   <- makeArtifact(ArtName, ArtType, Parameters, ArtId);
      focus(ArtId);
        start("").
     
-!create_artifact(ArtName, ArtType, Parameters)[error_code(Code)]
   <- .print("Error creating artifact ", Code).
